home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7258 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: pegasus.montclair.edu!harmon
  2. From: harmon@pegasus.montclair.edu (Derek Harmon)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: simple code, argc, argv, strcmp()
  5. Date: 13 Feb 1996 16:01:01 -0500
  6. Organization: Montclair State University
  7. Message-ID: <harmon.824243856@pegasus.montclair.edu>
  8. References: <11f7cc$17261a.3b3@daprez> <harmon.823197381@pegasus.montclair.edu> <9602100309.AA15971@dxmint.cern.ch>
  9. NNTP-Posting-Host: pegasus.montclair.edu
  10. X-Newsreader: NN version 6.5.0 #68 (NOV)
  11.  
  12. Dan Pop <danpop@mail.cern.ch> writes:
  13.  
  14. >harmon@pegasus.montclair.edu (Derek Harmon) writes:
  15. >>   Therefore, I would suggest that you only call Usage() when argv[1] is
  16. >>not "-d" AND not "-e":
  17. >>
  18. >>:   if (!strcmp(argv[1],"-d") && !strcmp(argv[1],"-e")) {
  19.  
  20. >Yet another guy who got it wrong :-)  This will evaluate to 1 only when
  21. >argv[1] is "-d" AND "-e", i.e. NEVER.
  22.  
  23.    Aye.. drop the exclamation points and batton down the hatches.  :)  It
  24. worked in plain English, though.  :)
  25.  
  26. >!strcmp() is EVIL and this thread demonstrated it a zillion times.
  27. >Don't use it if you want to preserve your sanity :-)
  28.  
  29.    Though I have reams of parser code that relies heavily upon it already,
  30. perhaps we can all put this is an include file somewhere,
  31.  
  32. :  #define STREQUAL(s1,s2)  (!strcmp((s1),(s2)))
  33.  
  34. and then those of use who don't think it can be rehabilitated can delete
  35. it.  :)
  36.                                              -- Stone
  37. --
  38. # Derek Harmon (aka Stonelight)    harmon@pegasus.montclair.edu
  39. # - Computer Science Undergrad, Montclair State University, NJ
  40. # - My views are my own, nobody else is this creative.  3;)>
  41. ... A bird in the hand makes it hard to blow your nose.
  42.